<?php

namespace User\Model;

use Think\Model;

class MeetingModel extends Model
{
    CONST STATUS_ACTIVE = 1;//正常、已发布--
    CONST STATUS_PENDING = 0;//待发布--
    CONST STATUS_DELETE = 9;//已删除--
    CONST STATUS_REFUSED = 2;//--未通过审核--
    CONST STATUS_USED = 3;//--已使用--

    public static function getStatus($value = 'all')
    {
        $status = [
            self::STATUS_ACTIVE => '正常',
            self::STATUS_PENDING => '待审核',
            self::STATUS_REFUSED => '未通过审核',
            self::STATUS_USED => '已使用'
        ];
        if (isset($status[$value])) {
            return $status[$value];
        }
        if ($value === 'all') {
            return $status;
        }
        return "未知";
    }

    //--是否需要分享--
    CONST SHARE_ABLE = 0;
    CONST SHARE_DISABLE = 1;

    //--是否需要微信授权--
    CONST WX_ABLE = 0;
    CONST WX_DISABLE = 1;

    //--是否需要注册--
    CONST REGISTER_NO = 0;
    CONST REGISTER_YES = 1;

    //--是否显示封面--
    CONST HEAD_NO = 0;
    CONST HEAD_YES = 1;

    //--菜单类型--
    CONST MENU_PIC_TEXT = 0;
    CONST MENU_TEXT = 1;
    CONST MENU_TEXT_TEXT = 2;
    CONST MENU_PIC = 3;
    CONST MENU_LINK = 4;

    public static function getMenu($type = 'all')
    {
        $type_arr = [
            self::MENU_PIC_TEXT => '图文模板',
            self::MENU_TEXT => '富文本',
            self::MENU_TEXT_TEXT => '文本+文本',
            self::MENU_PIC => '图片',
            self::MENU_LINK => '外链'
        ];
        if ($type === 'all') {
            return $type_arr;
        }
        if (isset($type_arr[$type])) {
            return $type_arr[$type];
        }
        return "未知";
    }

    //--字段类型--
    CONST FIELD_TEXT = 0;
    CONST FIELD_TEXTAREA = 1;
    CONST FIELD_SINGLE = 2;
    CONST FIELD_MULTIPLE = 3;
    CONST FIELD_PIC = 4;
    CONST FIELD_CITY = 5;
    CONST FIELD_ADDRESS = 6;
    CONST FIELD_DATE = 7;
    CONST FIELD_TIME = 8;
    CONST FIELD_RANGE = 9;
    CONST FIELD_VIDEO = 10;
    public static function getFieldType($type = 'all')
    {
        $type_arr = [
            self::FIELD_TEXT => '单行文本',
            self::FIELD_TEXTAREA => '多行文本',
            self::FIELD_SINGLE => '单选',
            self::FIELD_MULTIPLE => '多选',
            self::FIELD_PIC => '图片',
            self::FIELD_CITY => '城市',
            self::FIELD_ADDRESS => '地址',
            self::FIELD_DATE => '日期',
            self::FIELD_TIME => '时间',
            self::FIELD_RANGE => '时间范围',
            self::FIELD_VIDEO => '视频'
        ];
        if ($type === 'all') {
            return $type_arr;
        }
        if (isset($type_arr[$type])) {
            return $type_arr[$type];
        }
        return "未知";
    }

    //--格式--
    CONST FORMAT_NONE = 0;
    CONST FORMAT_NUMBER = 1;
    CONST FORMAT_DATE = 2;
    CONST FORMAT_EMAIL = 3;
    CONST FORMAT_PHONE = 4;
    CONST FORMAT_ID = 5;

    public static function getFieldFormat($format = 'all')
    {
        $format_arr = [
            self::FORMAT_NONE => '无',
            self::FORMAT_NUMBER => '数字',
            self::FORMAT_DATE => '日期',
            self::FORMAT_EMAIL => '邮箱',
            self::FORMAT_PHONE => '手机',
            self::FORMAT_ID => '身份证'
        ];
        if ($format === 'all') {
            return $format_arr;
        }
        if (isset($format_arr[$format])) {
            return $format_arr[$format];
        }
        return "未知";
    }

    //--是否必填--
    CONST REQUIRE_NO = 0;
    CONST REQUIRE_YES = 1;

    //--是否做为查询条件--
    CONST CONDITION_NO = 0;
    CONST CONDITION_YES = 1;

    //--是否需要电子票--
    CONST TICKET_NO = 0;
    CONST TICKET_YES = 1;

    //--是否需要审核--
    CONST VERIFY_NO = 0;
    CONST VERIFY_YES = 1;

    //--报名成功形式--
    CONST RESULT_LINK = 0;
    CONST RESULT_URL = 1;

    //--是否提供乘车服务--
    CONST BUS_NO = 0;
    CONST BUS_YES = 1;

    //--是否提供餐饮服务--
    CONST EAT_NO = 0;
    CONST EAT_YES = 1;

    //--是否提供住宿服务--
    CONST HOTEL_NO = 0;
    CONST HOTEL_YES = 1;

    //--是否有详情--
    CONST DETAIL_NO = 0;
    CONST DETAIL_YES = 1;//-有详情-
    CONST DETAIL_LINK = 2;//--外链--

    //--文字类型样式--
    CONST TEXT_SINGLE = 0; //-----
    CONST TEXT_MAIN = 1;
    CONST TEXT_UNMAIN = 2;

    //---现场互动--
    CONST LIVE_LUCKY = 1; //--现场抽奖--
    CONST LIVE_SIGNIN = 2; //--现场签到--
    public static function getLive($format = 'all')
    {
        $format_arr = [
            self::LIVE_LUCKY => '现场抽奖',
            self::LIVE_SIGNIN => '现场签到'
        ];
        if ($format === 'all') {
            return $format_arr;
        }
        if (isset($format_arr[$format])) {
            return $format_arr[$format];
        }
        return "未知";
    }

}

?>